Skip to content

Add a vector class to GridKit#418

Merged
pelesh merged 11 commits into
developfrom
slaven/vector
Jun 7, 2026
Merged

Add a vector class to GridKit#418
pelesh merged 11 commits into
developfrom
slaven/vector

Conversation

@pelesh
Copy link
Copy Markdown
Collaborator

@pelesh pelesh commented May 29, 2026

Description

Add vector class to GridKit to replace std::vector and provide portable data management.

Proposed changes

The LinearAlgebra::Vector class was ported from Re::Solve. It has basic initialization and data management functionality. I can be use as a vector, multivector or vector view class.

Checklist

  • All tests pass.
  • Code compiles cleanly with flags -Wall -Wpedantic -Wconversion -Wextra.
  • The new code follows GridKit™ style guidelines.
  • There are unit tests for the new code.
  • The new code is documented.
  • The feature branch is rebased with respect to the target branch.
  • I have updated CHANGELOG.md to reflect the changes in this PR. If this is a minor PR that is part of a larger fix already included in the file, state so.

Further comments

The multivector capability in this class should replace DenseMatrix object in GridKit.

@pelesh pelesh self-assigned this May 29, 2026
@pelesh pelesh added the enhancement New feature or request label May 29, 2026
Copy link
Copy Markdown
Collaborator

@PhilipFackler PhilipFackler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For an all-in-one solution like this, I would prefer some revisions as explained in my line comments. None of those is a deal-breaker if this is meant only for "advanced" use-cases, but I still think it would be helpful.

Comment thread GridKit/LinearAlgebra/Vector/Vector.hpp
Comment thread GridKit/LinearAlgebra/Vector/Vector.cpp Outdated
Comment thread GridKit/LinearAlgebra/Vector/Vector.cpp
Comment thread GridKit/LinearAlgebra/Vector/Vector.cpp Outdated
@pelesh
Copy link
Copy Markdown
Collaborator Author

pelesh commented May 30, 2026

For an all-in-one solution like this, I would prefer some revisions as explained in my line comments. None of those is a deal-breaker if this is meant only for "advanced" use-cases, but I still think it would be helpful.

All of your suggestions are spot on and should be incorporated before this PR is merged.

Copy link
Copy Markdown
Collaborator

@lukelowry lukelowry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need a zombie approach if we do merge this implementation. We should take the best parts of this and graft them onto a more scalable implementation that can isolate the Component in memory (is "closure" the right word here?).

Comment thread GridKit/LinearAlgebra/Vector/Vector.cpp
Comment thread GridKit/LinearAlgebra/Vector/Vector.cpp
Comment thread GridKit/LinearAlgebra/Vector/Vector.cpp
@pelesh pelesh requested a review from shakedregev June 5, 2026 20:22
Copy link
Copy Markdown
Collaborator

@nkoukpaizan nkoukpaizan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor comments.

I'm not convinced the class in GridKit needs to mirror Re::Solve, and I tend to prefer solutions that are driven by the application needs first, but I'm willing to see what happens when we try to use this in GridKit.

Comment thread tests/UnitTests/LinearAlgebra/Vector/VectorTests.hpp Outdated
Comment thread tests/UnitTests/LinearAlgebra/Vector/runVectorTests.cpp Outdated
Comment thread tests/UnitTests/LinearAlgebra/Vector/runVectorTests.cpp
Copy link
Copy Markdown
Collaborator

@shakedregev shakedregev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Address the comment and clarify that this is ready for testing.

@pelesh pelesh merged commit 56b6e3c into develop Jun 7, 2026
Comment on lines +382 to +383
{
// std::cout << x->getData("cpu")[i] << "\n";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this commented line was used for debugging. We can remove it before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants